////////////////////////////////
//config.lua
//Loads information from configuration.
//WORKS
////////////////////////////////

bbb.defaults={
	luabase=bbb.luabase,
	debug=true,
	log=false,
	curusercheck=0,
	g1totable=1,
	g1tofile=10,
	g1tosql=100,
	g1settingsdelay=120,
	servername="Bottlabs - Server",
	ip="127.0.0.1:27015",
}

bbb.newsettings=bbb.loadsettings()

for k,v in pairs(bbb.defaults) do
	if(bbb.newsettings[k]==nil) then
		bbb.set(k,v)
	else
		bbb.set(k,bbb.newsettings[k])
	end
end

bbb.defaults=nil
bbb.newsettings=nil

bbb.databaselayout={
	settings={
		setting={type="VARCHAR",length=20,default=""},
		value={type="VARCHAR",length=25,default=""},
		ip={type="VARCHAR",length=25,default="127.0.0.1:27015"},
	},
	servers={
		ip={type="VARCHAR",length=25,default="127.0.0.1:27015",key=true},
		name={type="VARCHAR",length=50,default="Bottlabs - Server"},
		rcon={type="VARCHAR",length=15,default=""},
	},
	users={
		steamid={type="VARCHAR",length=20,default="",key=true},
		ip={type="VARCHAR",length=15,default="0.0.0.0"},
		name={type="VARCHAR",length=20,default="unnamed"},
		deaths={type="MEDIUMINT",default="0",unsigned=true},
		frags={type="MEDIUMINT",default="0"},
		permissions={type="SMALLINT",default="1",unsigned=true},
		totaltime={type="FLOAT",default="0",unsigned=true},
		curtime={type="INT",default="0",unsigned=true},
		banned={type="INT",default="1",unsigned=true},
	}
}